import { createRequest } from '/@/api/service';
const module = 'ib/order/v1/WorkOrderApi';

/**
 * @function 新增工单
 * @param data
 * @param header
 * @returns {Promise}
 */
function INSERT_WORK_ORDER(
  data: OrderWorkOrder.InsertWorkOrderReq,
  header: object = {},
): Promise<OrderWorkOrder.InsertWorkOrderResp> {
  return createRequest(`${process.env.APP_API_URL}${module}/insertWorkOrder`, data, header, 'POST');
}

/**
 * @function 查询工单列表
 * @param data
 * @param header
 * @returns {Promise}
 */
function QUERY_WORK_ORDER_LIST(
  data: OrderWorkOrder.QueryWorkOrderListReq,
  header: object = {},
): Promise<OrderWorkOrder.QueryWorkOrderListResp> {
  return createRequest(
    `${process.env.APP_API_URL}${module}/queryWorkOrderList`,
    data,
    header,
    'POST',
  );
}

/**
 * @function 查看工单详情
 * @param data
 * @param header
 * @returns {Promise}
 */
function QUERY_WORK_ORDER_DETAIL(
  data: OrderWorkOrder.QueryWorkOrderDetailReq,
  header: object = {},
): Promise<OrderWorkOrder.QueryWorkOrderDetailResp> {
  return createRequest(
    `${process.env.APP_API_URL}${module}/queryWorkOrderDetail`,
    data,
    header,
    'POST',
  );
}

export { INSERT_WORK_ORDER, QUERY_WORK_ORDER_LIST, QUERY_WORK_ORDER_DETAIL };
